package cn.shit;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class TestForeach {
    public static void main(String[] args) {
        Collection c = new ArrayList();
        c.add("a");
        c.add("B");
        c.add("c");
        c.add("D");
        Iterator iterator = c.iterator();

        while (iterator.hasNext()) {
            System.out.println(iterator.next());
            iterator.remove();
        }
        System.out.println(c.size());
    }
}